package vfs.obj.association;

import java.util.Iterator;
import vfs.filter.VFSFilter;
import vfs.obj.entity.VFSNode;
import vfs.obj.entity.VFSUser;

/**
 * VFSUserToHomeDirectory is an association manipulator capable of 
 * manipulating the "home directory" relationship between Users and Nodes.
 * 
 * @author Matthew Eavenson <durandal@uga.edu>
 */
public interface VFSUserToHomeDirectory {
    
    /**
     * Returns an iterator over all users who have a given home directory,
     * and filtered by a specified filter.
     * 
     * @param node the home directory of potentially multiple users
     * @param filter a filter over the users who have the given home directory
     * @return an iterator over any matching users
     */
    Iterator<VFSUser> getUsers(VFSNode node, VFSFilter filter);
    
    /**
     * Returns a user's home directory.
     * 
     * @param user the user whose home directory we are requesting
     * @return the user's home directory
     */
    VFSNode getHomeDirectory(VFSUser user);
    
    /**
     * Sets the home directory for a specified user.
     * 
     * @param user the user whose home directory is to be set
     * @param directory the new home directory
     */
    void setHomeDirectory(VFSUser user, VFSNode directory);
    
}
